#region Usings

using System;
using System.Collections.Generic;
using System.Linq;

#endregion

namespace Karma.Framework.Core.Domain.Tools.Import.Validation
{
    public class ErrorSummary
    {
        public DateTime SummaryDate { get; set; }

        public IList<ErrorDescription> Errors { get; set; }

        public bool HasWarnings
        {
            get
            {
                if (Errors == null)
                {
                    return false;
                }
                return (from e in Errors
                        where e.Severity == ErrorSeverity.Warning
                        select e).Count() > 0;
            }
        }

        public bool HasErrors
        {
            get
            {
                if (Errors == null)
                {
                    return false;
                }
                return (from e in Errors
                        where e.Severity == ErrorSeverity.Error
                        select e).Count() > 0;
            }
        }

        public bool HasFatal
        {
            get
            {
                if (Errors == null)
                {
                    return false;
                }
                return (from e in Errors
                        where e.Severity == ErrorSeverity.Fatal
                        select e).Count() > 0;
            }
        }
    }
}